
public class WorkerThread extends Thread {
	private ThreadPool pool;
	
	public WorkerThread(ThreadPool pool) {
		this.pool = pool;
	}
		
	public void run() {
		while(!isInterrupted()) {	
			Runnable task = pool.getTask();
			if(task != null) {
				task.run();
			}
			else {
				System.out.println("No more tasks");
			}
		}
			
	}
}

